package _08_factory_method_pattern.v1_0;

import _08_factory_method_pattern.v1_0.human.Human;

/**
 * @Description: 人类创造工厂
 * @Auther: 2019/6/11 15:27 by zhang.jy
 */
public class HumanFactory extends AbstractHumanFactory {
	@Override
	public <T extends Human> T createHuman(Class<T> c) {
		//定义一个生产的人种
		Human human = null;
		try {
			//产生一个人种
			human = (T) Class.forName(c.getName()).newInstance();
		} catch (Exception e) {
			System.out.println("人种生成错误！");
		}
		return (T) human;
	}
}